<!DOCTYPE html>
<html lang="en">
  <head>
    <meta charset="UTF-8" />
    <meta name="viewport" content="width=device-width, initial-scale=1.0" />
    <title>Document</title>
  </head>
  <body>
    <script>
      function backDay() {
        var y = +prompt('请输入年份:')
        var res = isRunYear(y)
        if (res) {
          alert('29')
        } else {
          alert('28')
        }
      }
      backDay()

      //  判断闰年的函数
      function isRunYear(year) {
        var flag = false
        if ((year % 4 === 0 && year % 100 !== 0) || year % 400 == 0) {
          flag = true
        }
        return flag
      }
    </script>
  </body>
</html>
